<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<link href="<?php echo $this->baseUrl;?>/admincss/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="<?php echo $this->baseUrl;?>/adminjs/jquery.pack.js" /></script>
<body>
<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="<?php echo $this->url ($this->baseUrl, "publication", "doadd", "", "admin");?>">
<input type="hidden" name="type" value="<?php echo $this->type;?>" />
  <table width="100%" border="1" class="tableA" >
    <tr>
      <td colspan="3" align="center">添加</td>
    </tr>
    <tr>
      <td width="14%">分类</td>
      <td width="26%"><select name="typeid">
        <?php foreach ($this->list as $v){
        	echo '<option value="' . htmlspecialchars(addslashes($v['id'])) . '">' .  htmlspecialchars(addslashes($v['name'])) . '</option>';
        }?>
      </select></td>
      <td width="60%">&nbsp;</td>
    </tr>
    <tr>
      <td width="14%">标题</td>
      <td width="26%"><input name="name" type="text" id="name" size="30" /></td>
      <td width="60%">&nbsp;</td>
    </tr>
	<tr>
      <td width="14%">作者</td>
      <td width="26%"><input name="author" type="text" id="author" size="30" /></td>
      <td width="60%">&nbsp;</td>
    </tr>
    <tr>
      <td width="14%">关键字</td>
      <td width="26%"><input name="keywords" type="text" id="keywords" size="50" /></td>
      <td width="60%">&nbsp;</td>
    </tr>
    <tr>
      <td>摘要</td>
      <td> <textarea name="intro" id="intro" cols="50" rows="8"></textarea></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>排序</td>
      <td><input name="seq" type="text" id="seq" value="100" size="10" />&nbsp;<label for="top">置顶</label><input id="top" type="checkbox" value="1" name="top" /></td>
      <td>从大到小排序</td>
    </tr>
    <tr>
      <td>图片</td>
      <td colspan="2"><input name="image" type="file" id="image" value="" size="30" onchange="javascript:return imgFileCheck();"/></td>
    </tr>
    <tr>
      <td>PDF</td>
      <td colspan="2"><input name="pdf" type="file" id="pdf" value="" size="30" onchange="javascript:return pdfFileCheck();"/></td>
    </tr>
    <tr>
      <td>全文下载</td>
      <td colspan="2"><input name="down" type="file" id="down" value="" size="30"/></td>
    </tr>
    <tr>
      <td colspan="3" align="center"><input type="submit" name="button" id="button" value="提交" class="btn_submit"/></td>
    </tr>
  </table>
</form>
</body>
</html>
<script>
/**
 * 对所选择的文件类型加以判断
 */
function imgFileCheck(){
  var postfix = form1.image.value.match(/^(.*)(\.)(.{1,8})$/)[3].toLowerCase(); //获得选择的上传文件的后缀名的正则表达式
  if(!(postfix == "jpg"||postfix == "png"||postfix == "gif")) 
   { 
     alert('文件类型不正确，请选择jpg、png、gif文件 ！'); 
     var nf = form1.image.cloneNode(true); 
       nf.value=''; 
       form1.image.parentNode.replaceChild(nf, form1.image); 
     return false; 
   } 
}
function pdfFileCheck(){
  var postfix = form1.pdf.value.match(/^(.*)(\.)(.{1,8})$/)[3].toLowerCase(); //获得选择的上传文件的后缀名的正则表达式
  if(!(postfix == "pdf" || postfix== 'caj' || postfix=="doc" || postfix=="docx")) 
   { 
     alert('文件类型不正确，请选择pdf文件 ！'); 
     var nf = form1.pdf.cloneNode(true); 
       nf.value=''; 
       form1.pdf.parentNode.replaceChild(nf, form1.image); 
     return false; 
   } 
}
</script>